package Com.Project.Sleeping;

import java.util.ArrayList;

import android.app.Activity;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.TextView;
import android.view.View.OnClickListener;
import android.view.View;


public class SleepingTestProjectActivity extends Activity 
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
    	super.onCreate(savedInstanceState);
    	// Inflate your view
    	setContentView(R.layout.main);
    	Button button = (Button) findViewById(R.id.button1);
    	Button button_exit = (Button) findViewById(R.id.button2);
    	
    	// Get references to UI widgets
    	ListView myListView = (ListView)findViewById(R.id.myListView);
    	final EditText myEditText = (EditText)findViewById(R.id.myEditText);
    	final EditText editText1 = (EditText)findViewById(R.id.editText1);


    	final ArrayList<String> todoItems = new ArrayList<String>();
    	final ArrayAdapter<String> aa,bb,cc;
    	aa = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,todoItems);
    	bb = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,todoItems);

    	
    	myListView.setAdapter(aa);
    	myListView.setAdapter(bb);

    	
    	
    	button.setOnClickListener (new OnClickListener() 
    	{
    		public void onClick(View v) 
    		{
    			//EditText name = (EditText) findViewById(R.id.myEditText);
    			// TextView tv = (TextView) findViewById(R.id.myEditText);
    			//Show text on screen
    			//todoItems.add(0, myEditText.getText().toString());
    			todoItems.add(0, myEditText.getText().toString()+" "+editText1.getText().toString());
    			aa.notifyDataSetChanged();
    			myEditText.setText("");
    			
    			//todoItems.add(0, editText1.getText().toString());
    			bb.notifyDataSetChanged();
    			editText1.setText("");
 			
    		}
    		
    	});
    	
    	button_exit.setOnClickListener (new OnClickListener() 
    	{
    		public void onClick(View v) 
    		{
    			finish();
 			
    		}
    		
    	});
    	

    	
    }
}